import hashlib

# 简洁的写法
result = hashlib.sha256(b'hello world you are a good boy')
print("sha256: ",result.digest())

# 持续更新的写法
hash = hashlib.sha256()
hash.update(b'hello world')
hash.update(b' you are a good boy')
result = hash.digest()
print("sha256: ",result)
print("16进制hash: ",hash.hexdigest())
print(f"name:{hash.name}, digest 摘要长度:{hash.digest_size}, block哈希算法的内部块大小:{hash.block_size}",)
